package com.pangyangyang.elasticsearch.plugin.river;

import com.pangyangyang.elasticsearch.plugin.util.MessageRiverConstants;

import java.util.Map;

/**
 * 解析和执行river的配置信息
 * Created by yangwang on 2015/1/15.
 */
public class SettingsParser {

    private Map<String, Object> settings;
    private MessageRiverSettings handlerSettings, collectorSettings;

    public SettingsParser(Map<String, Object> settings) {
        this.settings = settings;
        Map<String, Object> collectorSettings = (Map<String, Object>) this.settings.get(MessageRiverConstants.SETTING_KEY_NAMESPACE_COLLECTOR);
        Map<String, Object> handlerSettings = (Map<String, Object>) this.settings.get(MessageRiverConstants.SETTING_KEY_NAMESPACE_HANDLER);
        this.collectorSettings = new MessageRiverSettings(collectorSettings);
        this.handlerSettings = new MessageRiverSettings(handlerSettings);
    }

    public MessageRiverSettings getHandlerSettings() {
        return handlerSettings;
    }

    public MessageRiverSettings getCollectorSettings() {
        return collectorSettings;
    }
}
